#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct Student {
    int id;
    char name[50];
    int score;
    struct Student* next;
};

struct Student* createList() {
    struct Student* head = NULL;
    struct Student* tail = NULL;
    int id;
    char name[50];
    int score;

    while (1) {
        scanf("%d", &id);
        if (id == 0) {
            break;
        }
        scanf("%s %d", name, &score);

        struct Student* newStudent = (struct Student*)malloc(sizeof(struct Student));
        newStudent->id = id;
        strcpy(newStudent->name, name);
        newStudent->score = score;
        newStudent->next = NULL;

        if (head == NULL) {
            head = newStudent;
            tail = newStudent;
        } else {
            tail->next = newStudent;
            tail = newStudent;
        }
    }
    return head;
}

void findStudent(struct Student* head, int id) {
    struct Student* temp = head;
    while (temp != NULL) {
        if (temp->id == id) {
            printf("%d %s %d\n", temp->id, temp->name, temp->score);
            return;
        }
        temp = temp->next;
    }
    printf("Not found\n");
}

int main() {
    struct Student* head = createList();
    int searchId;
    scanf("%d", &searchId);
    findStudent(head, searchId);
    return 0;
}
